﻿using Grow.Module.Options;

namespace Grow.Domain.EventBus
{
    public class DomainEventBusOptions : IOptions
    {
        /// <summary>
        /// 主机
        /// </summary>
        public string EnvironmentName { get; set; } = "EventBus";
        /// <summary>
        /// 连接字符串
        /// </summary>
        public string ConnectionString { get; set; } = string.Empty;
        /// <summary>
        /// 重试器单次执行数量,默认100
        /// </summary>
        public int RetryLimitCount { get; set; } = 100;

        /// <summary>
        /// 重试器在消息处理失败多久之后开始执行,单位秒,默认300s
        /// </summary>
        public int StartRetryAfter { get; set; } = 300;


        /// <summary>
        /// 重试器单次执行次数
        /// </summary>
        public int RetryFailed { get; set; } = 5;
        /// <summary>
        /// 最大失败重试次数,默认60次,最小值5
        /// </summary>
        public int RetryFailedMax { get; set; } = 60;

        /// <summary>
        /// 执行重试操作时,锁定时长,秒,默认110s,需要小于<see cref="RetryInterval"/>
        /// </summary>
        public int LockTime { get; set; } = 110;


        /// <summary>
        /// 失败重试间隔,单位秒,默认120s
        /// </summary>
        public string RetryCron { get; set; } = "0 0/2 * * * ?";

        /// <summary>
        /// 成功的消息多久后删除,单位小时,默认3天
        /// </summary>
        public int SucceedExpireHour { get; set; } = 3 * 24;

        /// <summary>
        /// 执行删除操作  1小时
        /// </summary>
        public string ExpirerCron { get; set; } = "0 * 0/1 * * * ?";


    }
}
